Skip to main content

Import

Usage

Return Type: UseQueryResult<LifiSwapQuote>

The hook returns all properties from React Query’s UseQueryResult with swap quote data. Here’s the detailed structure of the swapQuote.

Properties

data

SwapQuote | undefined The swap quote object containing:
  • currencyAddress: Address of the currency to be swapped
  • currencyBalance: Balance of the currency in the user’s wallet
  • price: The current price for the swap
  • maxPrice: Maximum price allowed for the swap (includes slippage)
  • to: The target contract address that handles the swap
  • transactionData: Encoded transaction data for executing the swap
  • transactionValue: The value to be sent with the transaction (for native tokens)
  • approveData: Encoded approval transaction data (if includeApprove is true and needed)
  • amount: The amount of currency to be received
  • amountMin: The minimum amount to be received after slippage

isLoading

boolean Loading state for the data fetch.

isError

boolean Error state indicating if the query failed.

error

Error | null Any error that occurred during data fetching.

Parameters

The hook accepts two parameters:

args: GetLifiSwapQuoteArgs

Note: You must provide either fromTokenAmount or toTokenAmount, but not both.

options: HooksOptions